<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>
<body>
	<table border = "0"  width = "100%" cellspacing = "0">
		<tr bgcolor = "#f5f5f5">
			<td  width = "20%" align = "center" valign = "center"><i><h1>fiction post</h1></i></td>
			<td  width = "35%" valign = "bottom">
				<c:if test="${empty requestScope.username}">
					<bean:message key="header.label.welcome" />!  
					<a href="<c:url value="dispatchAction.do?dest=login"/>"><bean:message key="header.label.login" /></a>
					<bean:message key="header.label.or" /> 
					<a href="<c:url value="dispatchAction.do?dest=register"/>"><bean:message key="header.label.register" /></a>
				</c:if>				
				<c:if test="${not empty requestScope.username}">
					<bean:message key="header.label.hi" />, 
					<c:if test="${not empty requestScope.firstName}">
						<b>${requestScope.firstName}</b> (${requestScope.username})!&nbsp;
						<a href="<c:url value="loginAction.do?method=logout"/>"><bean:message key="header.label.logout" /></a>
					</c:if>
					<c:if test="${empty requestScope.firstName}">
						<b>${requestScope.username}</b>!&nbsp;
						<a href="<c:url value="loginAction.do?method=logout"/>"><bean:message key="header.label.logout" /></a>
					</c:if>					
				</c:if>				
			</td>
			<td width = "45%"  valign = "bottom">			
			<table border = "0" width = "100%" hight = "100%">
				<tr align = "left">
					<td>
						<a href="<c:url value="mainAction.do"/>"><bean:message key="header.label.main" /></a>
						<a href="<c:url value="articleSearchAction.do"/>"><bean:message key="header.label.search" /></a>
						<a href="<c:url value="createArticleAction.do"/>"><bean:message key="header.label.postArticle" /></a>
						<c:if test="${not empty requestScope.userId}">
							<a href="<c:url value="articleSearchAction.do?method=author&userId=${requestScope.userId}"/>"><bean:message key="header.label.myArticles" /></a>
						</c:if>
						<a href="<c:url value="ajaxTestAction.do"/>">ajax test</a>
					</td>
				</tr>
				<tr>
					<td align = "right">
					<c:if test="${sessionScope.current_lang == 'uk'}">
						<a href="<c:url value="changeLangAction.do?lang=en"/>"><bean:message key="header.label.eng" /></a>
					</c:if>
					<c:if test="${sessionScope.current_lang == 'en'}">
						<a href="<c:url value="changeLangAction.do?lang=uk"/>"><bean:message key="header.label.ukr" /></a>
					</c:if>
					&nbsp;
					</td>
				</tr>				
			</table>
			</td>			
		</tr>
	</table>

</body>
</html>
